<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>门店商品信息审核</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
	
		var goodsId = null;
		
		$(document).ready(function() {
			$("#importBox_goods").hide();
			$("#examineInfoDiv").hide();
			$("input[name='examineStatus']").click(function(){
				if($(this).val()==3){
					$("#examineInfo").val("");
					$("#examineInfoDiv").hide();
				}else{
					$("#examineInfoDiv").show();
					$("#examineInfo").val("");
				}
			})
			
			$("#forms").validate({
			    rules: {
			    	examineInfo: {
			        required: true,
			        maxlength: 100
			      },
			    },
			    messages: {
			    	examineInfo: {
			        required: "请输入不通过原因",
			        maxlength: "最多输入100字"
			      }
			    }
			});
		});
		
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }

		function shows(n){
			goodsId = n;
			$("#examineStatus").attr("checked",true);
			$("#importBox_goods").show();
		}
		
		function confirm_imbox(){
			if($("#forms").valid()){
				$("#id").val(goodsId);
				$("#queryPartsCode2").val($("#queryPartsCode").val());
				$("#queryMaterielCode2").val($("#queryMaterielCode").val());
				$("#queryCnName2").val($("#queryCnName").val());
				$("#forms").submit();
			}
		}
		
		function close_imbox(){
			$("#examineInfoDiv").hide();
			$("#importBox_goods").hide();
		}

	</script>
	
	<style>
		#importBox_goods{
			position:fixed;
			padding:0 15px;
			width:300px;
			background:#FFF;
			top:10%;
			left:25%;
			margin:0 auto;
			border:1px solid #CCC;
			box-shadow:3px 3px 10px 4px #DDD;
			z-index: 9999;
			
		}
		#importBox_goods .ib_title{
			margin-bottom:35px;
		}
		
		#importBox_goods .ib_bottom{
			margin-bottom:35px;
		}
       
	</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/goodsstoreexamine/">门店商品列表</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="goods" action="${ctx}/sys/goodsstoreexamine/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>配件编号：</label>
				<form:input path="queryPartsCode" htmlEscape="false" maxlength="100" class="input-medium"/>
			</li>
			<li><label>物料编号：</label>
				<form:input path="queryMaterielCode" htmlEscape="false" maxlength="100" class="input-medium"/>
			</li>
			<li><label>商品名称：</label>
				<form:input path="queryCnName" htmlEscape="false" maxlength="100" class="input-medium"/>
			</li>
			<li class="btns">
				<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
			</li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>物料编号</th>
				<th>配件编号</th>
				<th>商品编号</th>
				<th>商品名称</th>
				<th>制造商品牌</th>
				<th>售价</th>
				<th>会员价</th>
				<th>所属门店</th>
				<th>提交时间</th>
				<shiro:hasPermission name="sys:goodsstoreexamine:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="goods">
			<tr>
				<td>
					${goods.materielCode}
				</td>
				<td>
					${goods.partsCode}
				</td>
				<td>
					${goods.code}
				</td>
				<td>
					<a href="${ctx}/sys/goodsplatformmanger/goodsDetail?goodsCode=${goods.code}&tagUrl=${ctx}/sys/goodsstoreexamine/list&tagName=门店商品列表">${goods.cnName}</a>
				</td>
				<td>
					${goods.venderName}
				</td>
				<td>
					${goods.price}
				</td>
				<td>
					${goods.memberPrice}
				</td>
				<td>
					${goods.storeCnName}
				</td>
				<td>
					<fmt:formatDate value="${goods.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<shiro:hasPermission name="sys:goodsstoreexamine:edit">
				<td>
					<a href="#"  onclick="shows('${goods.id}')">审核</a>
				</td>
				</shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
	
	<!-- 弹框 -->
	<div id="importBox_goods" class="hide">
			<div class='ib_title'>
			 <h3>请选择审核结果</h3>
			</div>
			 <form action="${ctx }/sys/goodsstoreexamine/save" method="post" id="forms">
					 <input type="radio" id="examineStatus" name="examineStatus" checked='checked' value="3"/> 通过 <input type="radio" id="unExamineStatus" name="examineStatus" value="4"/> 不通过：
					
					 <div id="examineInfoDiv">
                     <textarea rows="3" placeholder="请输入不通过原因" cols="20" name="examineInfo" id="examineInfo" style="width:285px;height:85px;margin-top:10px;resize:vertical;" class="required">
                                                                                                              
                     </textarea>
                     </div>
                     <input id="id" name="id" type="hidden" />
                     <input id="queryPartsCode2" name="queryPartsCode" type="hidden"/>
                     <input id="queryMaterielCode2" name="queryMaterielCode" type="hidden"/>
                     <input id="queryCnName2" name="queryCnName" type="hidden"/>
			        </form>
			<div class='ib_bottom'>
			 		<input id="btnCancel" class="btn" type="button" style='' value="确定" onclick="confirm_imbox()"/>
					<input id="btnCancel" class="btn" type="button" style='margin-left:10px;' value="取消" onclick="close_imbox()"/>
			</div>
					
	</div>
</body>
</html>